/*****************************************************************************
 * Included Files
 ****************************************************************************/
#ifndef _CT_TIMER_H
#define _CT_TIMER_H

#include "ct_type.h"

#define CT_USE_TIMER0 0
#define CT_USE_TIMER1 1
#define CT_USE_TIMER2 2
#define CT_USE_TIMER3 3



#define TIMER0 0
#define TIMER1 1
#define TIMER2 2
#define TIMER3 3




typedef enum {
    TIM_13BIT = 0,
    TIM_16BIT,
    TIM_8BIT_AUTORELOAD,
    TIM_TWO_8BIT,
} ct_timer_mode_t;




typedef struct
{
    unsigned char mode;
    ct_bool       intt;     // interrupt
    unsigned int  value;    // timer load value
    ct_bool       run;
} timer_init_t;

/*****************************************************************************
 * Public Functions
 ****************************************************************************/

void ct_timer0_run(void);
void ct_timer0_stop(void);
void ct_timer0_IntEnable(void);
void ct_timer0_IntDisable(void);
void ct_timer0_load(unsigned int value);

void ct_timer1_run(void);
void ct_timer1_stop(void);
void ct_timer1_IntEnable(void);
void ct_timer1_IntDisable(void);
void ct_timer1_load(unsigned int value);

void ct_timer2_run(void);
void ct_timer2_stop(void);
void ct_timer2_IntEnable(void);
void ct_timer2_IntDisable(void);
void ct_timer2_load(unsigned int value);

char ct_timer_inilize(ct_u8 TIMx, timer_init_t *info);



#endif